package com.hmall.item.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hmall.item.pojo.Item;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.Param;

public interface ItemMapper extends BaseMapper<Item> {
    @Update("UPDATE tb_item SET stock = stock - #{num} WHERE id = #{id}")
    boolean downStockById(@Param("id") Long id,@Param("num") Integer num);

    @Update("UPDATE tb_item SET stock = stock + #{num} WHERE id = #{id}")
    boolean upStockById(@Param("id") Long id,@Param("num") Integer num);
}
